import arcpy

arcpy.AddField_management("all2015", "ID", "LONG", 9, "", "",
                          "", "NULLABLE")

alist = ["all2008","all2015","all2017"]
for l in alist:
    i=0
    #引入da模块中的updatecursor对象
    rows = arcpy.da.UpdateCursor(l,field_names=["ID"])
    for row in rows:
        i+=1
        row[0]=i
        rows.updateRow(row)
        if i%1000 == 0:
            print "line" + str(i) + "has been inserted"
    print l+" Done!"

#导出检验
rows2 = arcpy.SearchCursor("all2017",fields="ID")
for row in rows2:
    print row.getValue("ID")
print "Done!"

